# -*- coding: UTF-8 -*-
"""
@Filename:exerc4.py
@author:Cora
@time:2025-03-21
"""
import random

def generate_verification_code():
    all_characters = []
    for i in range(26):
        all_characters.append(chr(65 + i))  # 大写字母 ASCII 值从 65（A）开始
        all_characters.append(chr(97 + i))  # 小写字母 ASCII 值从 97（a）开始
    verification_code = ''
    for _ in range(4):
        if random.choice([True, False]):  # 随机选择 True 或 False
            verification_code += random.choice(all_characters[:26])  # 选择大写字母
        else:
            verification_code += random.choice(all_characters[26:])  # 选择小写字母
    return verification_code

verification_code = generate_verification_code()
print("生成的验证码为:", verification_code)